<?php
/**
*	创建一个js方法
*/
namespace Rainrock\Framework\kernel\Html;




class HtmlFun{
	
	private $codearr = [],$canstr = '';
	
	public static function get()
	{
		return new HtmlFun();
	}
	
	public function addCode($str, $endfh=';')
	{
		if($str){
			if($endfh)$str .= $endfh;
			$this->codearr[] = $str;
		}
		return $this;
	}
	
	public function addCan($val)
	{
		$this->canstr = $val;
		return $this;
	}
	
	public function show()
	{
		$str[] = 'function('.$this->canstr.'){';
		foreach($this->codearr as $v)$str[] = $v;
		$str[] = '}';
		return join(PHP_EOL, $str);
	}
}